import { S } from '../../s';
import { IPSAppView } from '../../app/view/ipsapp-view';
import { IPSControl } from '../ipscontrol';
import { IPSDBAppViewPortletPart } from './ipsdbapp-view-portlet-part';
import { PSDBPortletPartImpl } from './psdbportlet-part-impl';

export class PSDBAppViewPortletPartImpl
  extends PSDBPortletPartImpl
  implements IPSDBAppViewPortletPart
{
  protected contentpscontrol: IPSControl;
  getContentPSControl(): IPSControl | null {
    if (this.contentpscontrol != null) return this.contentpscontrol;
    const value = this.M.getContentPSControl;
    if (value == null) {
      return;
    }
    this.contentpscontrol = this.findPSControl(value);
    return this.contentpscontrol;
  }

  protected portletpsappview: IPSAppView;
  getPortletPSAppView(): IPSAppView | null {
    return (
      this.portletpsappview ||
      (this.portletpsappview = this.fillObjectModel(
        S._1e,
        this.M.getPortletPSAppView,
        S._33e,
      ) as IPSAppView)
    );
  }

  get portletType():
    | 'LIST'
    | 'CHART'
    | 'VIEW'
    | 'HTML'
    | 'TOOLBAR'
    | 'ACTIONBAR'
    | 'CUSTOM'
    | 'APPMENU'
    | 'CONTAINER'
    | 'RAWITEM' {
    return this.M.portletType;
  }
  get cls(): string {
    return 'PSDBAppViewPortletPartImpl';
  }
  instanceof(cls: string): boolean {
    if (cls == S._225) return true;
    return super.instanceof(cls);
  }
}
